package com.hj.demo.homework;

public class Test2 {
    public static void main(String[] args) {
        Goods goods = new Goods(1001, "薯片", 100, 5, "促销");
        goods.getPrice();
        goods.upDate();
    }
}
class Goods{
    public int id;
    public String name;
    public int num;
    public int price;
    public String S;

    public Goods(int id, String name, int num, int price, String s) {
        this.id = id;
        this.name = name;
        this.num = num;
        this.price = price;
        S = s;
    }

    public void getPrice(){
        System.out.println("价格为"+(num*price));
    }
    public void upDate(){
        System.out.println("库存量为"+num);
    }
}